<div class="loans form">
<?php echo $this->Session->flash(); ?>
<?php echo $this->Form->create('Loan');?>
	<fieldset>
 		<legend><?php __('Devolution'); ?></legend>
 		<p><?php __('Fill one of the fields below to make the return of the book'); ?></p>
	<?php
		echo $this->Form->input('copy_id', array('id' => 'LoanCopyId', 'type' => 'text', 'div' => 'ui-widget'));
		echo $this->Form->input('person_id', array('id' => 'LoanPersonId', 'type' => 'text', 'div' => 'ui-widget'));
		//echo $this->Form->input('devolution_date', array('id' => 'LoanEstimatedDevolution', 'type' => 'text', 'div' => 'ui-widget'));
		echo $this->Form->end(__('Search', true));
	?>
	</fieldset>
<?php if ( isset($loan) ) :?>
<?php //print_r($loan)?>
	<fieldset>
 		<legend><?php __('Information'); ?></legend>

		<dl>
			<dt><?php __('Person') ?></dt>
			<dd><?php echo $loan['Person']['name'] ?></dd>
			<dt><?php __('Estimated Devolution') ?></dt>
			<dd><?php echo $time->format('d/m/Y', $loan['Loan']['estimated_devolution']); ?></dd>
		</dl>
		<table cellpadding="0" cellspacing="0">
			<tr>
				<th width="10%"><?php __('Id');?></th>
				<th width="90%"><?php __('Title');?></th>
			</tr>
<?php
	$i = 0;
	foreach ($loan['Copy'] as $copy):
		$class = null;
		if ($i++ % 2 == 0) {
			$class = ' class="altrow"';
		}
?>
	<tr<?php echo $class;?>>
		<td><?php echo $copy['id']; ?>&nbsp;</td>
		<td><?php echo $copy['Publication']['title']; ?>&nbsp;</td>
	</tr>
<?php endforeach; ?>
		</table>
		<?php echo $this->Form->end(__('Return', true));?> 		
 	</fieldset>
<?php else : ?>
	
<?php endif; ?>	
</div>
<div class="actions">
	<h3><?php __('Actions'); ?></h3>
	<ul>

		<li><?php echo $this->Html->link(__('List Loans', true), array('action' => 'index'));?></li>
		<li><?php echo $this->Html->link(__('List People', true), array('controller' => 'people', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Person', true), array('controller' => 'people', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Users', true), array('controller' => 'users', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New User', true), array('controller' => 'users', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Copies', true), array('controller' => 'copies', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Copy', true), array('controller' => 'copies', 'action' => 'add')); ?> </li>
	</ul>
</div>